package com.spzx.product.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.spzx.product.domain.ProductSpec;
import com.spzx.product.mapper.ProductSpecMapper;
import com.spzx.product.service.ProductSpecService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 商品规格 服务实现类
 * </p>
 *
 * @author atguigu
 * @since 2025-04-28
 */
@Service
public class ProductSpecServiceImpl extends ServiceImpl<ProductSpecMapper, ProductSpec> implements ProductSpecService {

    @Autowired
    private ProductSpecMapper productSpecMapper;
    @Override
    public List<ProductSpec> selectProductSpecList() {
        List<ProductSpec> productSpecList = productSpecMapper.getProductSpecList();
        return productSpecList;
    }

    @Override
    public List<ProductSpec> getProductSpecList(Long id) {
        LambdaQueryWrapper<ProductSpec> productSpecLambdaQueryWrapper = new LambdaQueryWrapper<>();
        productSpecLambdaQueryWrapper.eq(ProductSpec::getCategoryId,id);
        List<ProductSpec> productSpecList = productSpecMapper.selectList(productSpecLambdaQueryWrapper);
        return productSpecList;
    }
}
